import os
import pandas as pd

path = 'C:/Users/123/Desktop/'
fileNames = os.listdir(path)
returnArr = []
for fileName in fileNames:
    if fileName.endswith('.xlsx'):
        returnArr.append(fileName)
        #print('xlsx:' + path + fileName)
    elif fileName.endswith('.xls'):
        returnArr.append(fileName)
        #print('xls: '+path + fileName)
newExcel = pd.DataFrame(returnArr)
newExcel.to_csv(path+'测试保存.csv',encoding='utf-8-sig')
newExcel.to_excel(path + '测试.xlsx',encoding='utf-8-sig')